
package com.etc.user.controller;

import java.io.File;
import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.io.FileUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import com.etc.entity.Comment;

import com.etc.user.service.CommentService;
import com.etc.util.CommonMessage;
import com.etc.util.PageData;

/**
 * @author afrian
 *
 *         date: 2019年4月30日 早上10点20
 */
@Controller
public class CommentController {

	@Resource(name = "commentService")
	private CommentService commentService;

	@RequestMapping(value = "addComment", method = RequestMethod.POST)
	@ResponseBody
	public CommonMessage addEmployee(@RequestBody Comment c) {
		Comment comment = new Comment();
		comment.setOrderid(c.getOrderid());
		comment.setUserid(c.getUserid());

		// 这里返回json格式对象
		CommonMessage cm = new CommonMessage();
		boolean flag = commentService.addComment(comment);

		if (flag) {
			cm.setMsg("添加成功");
		} else {
			cm.setMsg("添加失败");
		}

		return cm;

	}

}
